package cz.schovjan.proj.entity;

import java.util.Collection;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

@Entity
@Table(name = "BAND", schema = "PPRO")
public class BandEntity {
	
	private Integer id;
	private String name;
	private String description;
	private String email;
	private Date creation;
	private Date breakup;
	private Collection<ConcertEntity> concerts;
	private Collection<MemberEntity> members;
	private Collection<SongEntity> songs;

	public BandEntity() {
	}

	public BandEntity(Integer id, String name, String description, String email,
			Date creation, Date breakup) {
		this.id = id;
		this.name = name;
		this.description = description;
		this.email = email;
		this.creation = creation;
		this.breakup = breakup;
	}

	@Id
	@GeneratedValue
	@Column(name = "ID", unique = true, nullable = false)
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "NAME", length = 50, nullable = false)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "DESCRIPTION", length = 200)
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "EMAIL", length = 50)
	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "CREATION")
	public Date getCreation() {
		return creation;
	}

	public void setCreation(Date creation) {
		this.creation = creation;
	}

	@Column(name = "BREAKUP")
	public Date getBreakup() {
		return breakup;
	}

	public void setBreakup(Date breakup) {
		this.breakup = breakup;
	}
	
	@ManyToMany(fetch = FetchType.LAZY)
	public Collection<ConcertEntity> getConcerts() {
		return concerts;
	}

	public void setConcerts(Collection<ConcertEntity> concerts) {
		this.concerts = concerts;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	public Collection<MemberEntity> getMembers() {
		return members;
	}

	public void setMembers(Collection<MemberEntity> members) {
		this.members = members;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	public Collection<SongEntity> getSongs() {
		return songs;
	}

	public void setSongs(Collection<SongEntity> songs) {
		this.songs = songs;
	}

	@Override
	public String toString() {
		return "Band [id=" + id + ", name=" + name + ", description="
				+ description + ", email=" + email + ", creation="
				+ creation + ", breakup=" + breakup + "]";
	}
}
